﻿Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Text
Imports Exp.DAL
Imports Exp.Model
Public Class Country_Service
    Public Function GetAll() As List(Of REM_Country)
        Dim ctx As New EXPEntities
        Dim list = ctx.REM_Country.ToList()
        Return list
    End Function
    Public Sub Add(objREM_Country As REM_Country)
        Dim ctx As New EXPEntities
        ctx.REM_Country.AddObject(objREM_Country)
        ctx.SaveChanges()
    End Sub
    Public Sub Delete(ByVal iCountryID As Integer)
        Dim ctx As New EXPEntities
        Dim obj = ctx.REM_Country.Where(Function(o) o.Country_ID = iCountryID).FirstOrDefault()
        ctx.REM_Country.DeleteObject(obj)
        ctx.SaveChanges()
    End Sub
    Public Function GetByID(ByVal iCountryID As Integer) As REM_Country
        Dim ctx As New EXPEntities
        Dim obj = ctx.REM_Country.Where(Function(o) o.Country_ID = iCountryID).FirstOrDefault()
        Return obj
    End Function
    Public Sub Edit(objREM_Country As REM_Country)
        Dim ctx As New EXPEntities
        Dim obj = ctx.REM_Country.Where(Function(o) o.Country_ID = objREM_Country.Country_ID).FirstOrDefault()
        obj.CountryCODE = objREM_Country.CountryCODE
        obj.CountryName = objREM_Country.CountryName
        ctx.SaveChanges()
    End Sub
End Class
